/**
 * 
 */
package mdb.com.vn.web.view;

import java.io.Serializable;
import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;

import mdb.com.vn.model.FixedDeposits;

/**
 * @author tu.dod
 * 
 */
public class FDDataModel extends ListDataModel<FixedDeposits> implements
		SelectableDataModel<FixedDeposits>,Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public FDDataModel() {

	}
	public FDDataModel(List<FixedDeposits> data) {
		super(data);
	}

	@SuppressWarnings("unchecked")
	@Override
	public FixedDeposits getRowData(String rowKey) {
		List<FixedDeposits> deposits = (List<FixedDeposits>) getWrappedData();
		for (FixedDeposits fixedDeposits : deposits) {
			if(fixedDeposits.getSavingbookNo().equals(rowKey)){
				return fixedDeposits;
			}
		}
		return null;
	}

	@Override
	public Object getRowKey(FixedDeposits fixedDeposits) {
		// TODO Auto-generated method stub
		return fixedDeposits.getSavingbookNo();
	}

}
